home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / msc4add / insert.ws < prev   
Text File  |  1987-01-24  |  11KB  |  251 lines

  1. .. to edit, put cursor on next line then press ^OF to set tabs & marginsL----!----!----!----!----!----!----!----!----!----!----!----!----!----!----!----!----!----!----!---+
  2. .mt0
  3. .OP
  4. .CW8
  5. .po15
  6.      Microsoft C file routines by function
  7.                                         see p. 88-c for explanation of---> err       inc
  8. Directory Control   - uses <direct.h>
  9.  
  10. char *getcwd (char *pathbuf, int buflen)                                   NULL*
  11. int   chdir (char *pathname)                                               -1*
  12. int   mkdir (char *pathname)                                               -1*
  13. int   rmdir (char *pathname)                                               -1*
  14.  
  15.  
  16. File Handling          - uses 1=<io.h>, 2=<stdio.h>, 43=<fcntl.h>,
  17.                     4=<sys\types.h> & <sys\stat.h>, 5=<sys\locking.h>
  18.  
  19. int   umask (int pmode)                                                              1,4
  20. int   rename (char *oldname, char *newname)                                ~0*       1 or 2
  21. int   remove/unlink (char *pathname)                                       -1*       1 or 2
  22. char *mktemp (char *template)                                              NULL      1
  23. int   access (char *pathname, int access-mode)                             -1*       1
  24. int   chmod (char *pathname, int pmode)                                    -1*       1,4
  25. int   stat (char *pathname, struct stat *buffer)                           -1*       4
  26.  
  27. int   fstat (int handle, struct stat *buffer)                              -1*       4
  28. int   isatty (int handle)                                                            1
  29. int   setmode (int handle, int translation-mode)                           -1*       1,3
  30. int   locking (int handle, int lock-mode, long nbyte)                      -1*       1,5
  31. long  filelength (int handle)                                              -1L*      1
  32. int   chsize (int handle, long size)                                       -1*       1
  33.  
  34.  
  35. Low Level I/O       - uses <io.h>, & maybe <stdio.h> for "EOF", etc.
  36.                also: 1=<fcntl.h>, 2=<share.h>, 3=<sys\types.h> & <sys\stat.h>
  37.  
  38. int   open (char *pathname, int oflag[, int pmode])                        -1*       1[,3]
  39. int   sopen (char *pathname, int oflag, int shflag[, int pmode])           -1*       1,2[,3]
  40. int   creat (char *pathname, int pmode)                                    -1*       1,3
  41.  
  42. int   dup (int handle)                                                     -1*
  43. int   dup2 (int handle, int dup-handle)                                    -1*
  44. int   close (int handle)                                                   -1*
  45.  
  46. long  lseek (int handle, long offset, int origin)                          -1L*
  47. long  tell (int handle)                                                    -1L*
  48. int   eof (int handle)                                                     -1*
  49.  
  50. int   read (int handle, char *buffer, unsigned int count)                  0/-1*
  51. int   write (int handle, char *buffer, unsigned int count)                 -1*
  52.  
  53.                               88-a
  54. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _+
  55. .PAèStream I/O     - uses <stdio.h>
  56.           also: 1=<varargs.h>  (for UNIX), -or- <stdarg.h>  (for ANSI C)
  57.  
  58. FILE *fopen (char *pathname, char *type)                                   NULL
  59. FILE *freopen (char *pathname, char *type, FILE stream)                    NULL
  60. FILE *tmpfile (void)                                                       NULL
  61.  
  62. FILE *fdopen (int handle, char *type)                                      NULL
  63.  
  64. int   fclose (FILE *stream)                                                EOF
  65. int   fcloseall (void)                                                     EOF
  66.  
  67. void  setbuf (FILE *stream, char *buffer)
  68. int   setvbuf (FILE *stream, char *buffer, int buftype, int buflen)        ~0
  69.  
  70. void  rewind (FILE *stream)
  71. int   fseek (FILE *stream, long offset, int origin)                        ~0 or ?
  72. long  ftell (FILE *stream)                                                 -1L
  73.  
  74. int   fileno (FILE *stream)                                                n/a or ?
  75.  
  76. int   feof (FILE *stream)
  77. int   ferror (FILE *stream)
  78. void  clearerr (FILE *stream)
  79.  
  80. char *tempnam (char *dir, char *prefix)                                    NULL
  81. char *tmpnam (char *string)                                                NULL
  82. int   rmtmp (void)
  83.  
  84. int   fflush (FILE *stream)                                                EOF
  85. int   flushall (void)
  86.  
  87. int   fread (char *buffer, int it-size, int it-count, FILE *stream)        < it-count
  88. int   getc/fgetc (FILE *stream)                                            ?EOF
  89. int   getw (FILE *stream)                                                  ?EOF
  90. char *fgets (char *buffer, int bufsize, FILE *stream)                      ?NULL
  91. int   fscanf (FILE *stream, char *format[, args...])                       EOF!
  92.  
  93. int   ungetc (int c, FILE *stream)                                         EOF
  94.  
  95. int   fwrite (char *buffer, int it-size, int it-count, FILE *stream)       < it-count
  96. int   putc/fputc (int c, FILE *stream)                                     ?EOF
  97. int   putw (int binint, FILE *stream)                                      ?EOF
  98. int   fputs (char *string, FILE *stream)                                   EOF
  99. int   fprintf (FILE *stream, char *format[, args...])
  100. int   vfprintf (FILE *stream, char *format, va_list arg-ptr)                         1
  101.  
  102.                               88-b
  103. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _+
  104. .PAè (stdin/stdout stream-routines)
  105.  
  106. int   getchar/fgetchar (void)                                              ?EOF
  107. char *gets (char *buffer)                                                  ?NULL
  108. int   scanf (char *format[, args...])                                      EOF!
  109.  
  110. int   putchar/fputchar (int c)                                             ?EOF
  111. int   puts (char *string)                                                  EOF
  112. int   printf (char *format[, args...])
  113. int   vprintf (char *format, va_list arg-ptr)                                        1
  114.  
  115.  (buffer i/o stream-routines)
  116.  
  117. int   sscanf (char *buffer, char *format[, args...])                       EOF!
  118. int   sprintf (char *buffer, char *format[, args...])
  119. int   vsprintf (char *buffer, char *format, va_list arg-ptr)                         1
  120.  
  121.  
  122. Console and port I/O     - uses <conio.h> & <stdio.h> for "EOF", etc.
  123.  
  124. int   getch (void)
  125. int   getche (void)
  126. char *cgets (char *str)
  127. int   cscanf (char *format[, args...])                                     EOF!
  128.  
  129. int   ungetch (int c)                                                      EOF
  130.  
  131. void  putch (int c)
  132. void  cputs (char *str)
  133. int   cprintf (char *format[, args...])
  134.  
  135. int   kbhit (void)
  136. int   inp (unsigned port)
  137. int   outp (unsigned port, int value)
  138.  
  139. -----------------
  140.  
  141. err = error indication (if any);  '*' signifies that errno is set;  ~0 means non-zero;
  142.   lone '?' means that return value may be undefined;  ?XXX means that XXX may (or not)
  143.   indicate an error -check further with eof, feof, ferror;  EOF! means that EOF is always
  144.   end-of-file;  EOF is defined as -1 in stdio.h (along with NULL, etc.)
  145.      note: to use errno, must define errno, & maybe sys_nerr, sys_errlist[].  
  146.  
  147. inc = #include-file requirements - see key at top of each section.
  148.  
  149.  
  150.  
  151.                               88-c
  152. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _+
  153. .PAèMicrosoft C string & buffer manipulation routines
  154.  
  155.      <string.h> declares all functions; <memory.h> declares only buffer functions.
  156.  
  157.  
  158. Copy     - returns pointer to destination (except memccpy)
  159.  
  160. char *strcpy (dst,src)        copies src to dst, including \0
  161. char *strncpy (dst,src,n)     copies exactly n chars, \0-padding if n > len(src)
  162.  
  163. char *memcpy (dst,src,n)      copies n bytes from src to dst (overlap handled ok)
  164. char *memccpy (dst,src,c,n)   same, except stops after 1st c (if any)
  165.      note: memccpy returns pointer to next char in dst following c (or NULL)
  166.  
  167. void  movedata (src-seg,src-off,dst-seg,dst-off,n)     copies far-data
  168.      note: movedata useful in small and medium models, (memcpy ok for large)
  169.  
  170. char *strdup (str)            allocates (malloc) & copies to new storage (NULL = error)
  171.  
  172.  
  173. Compare        - returns <0, 0, >0 depending on lexicographic order
  174.                - case-insensitive routines treat all alpha as lower case
  175.  
  176. int   strcmp (str1,str2)           compare str1 : str2
  177. int   stricmp/strcmpi (str1,str2)  same, case-insensitive
  178. int   strncmp (str1,str2,n)        compares 1st n chars
  179. int  *strnicmp (str1,str2,n)       same, case-insensitive
  180.  
  181. int   memcmp (buf1,buf2,n)         compares n bytes buf1 : buf2
  182. int   memicmp (buf1,buf2,n)        same, case-insensitive
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.                               88-d
  201. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _+
  202. .PAè     String & buffer routines (continued)
  203.  
  204. Examine
  205.  
  206. char *strstr (str,key)        points to 1st key-string in str (or NULL)
  207.  
  208. char *strchr (str,c)          points to 1st c in str (or NULL) - allows \0
  209. char *strrchr (str,c)         points to last c (or NULL)
  210.  
  211. char *memchr (buf,c,n)        points to 1st c in 1st n bytes of buf (or NULL)
  212.  
  213. char *strpbrk (str,set)       points to 1st char in str from set (or NULL) - no \0
  214.  
  215. int   strlen (str)            length, not including \0 (i.e., index of the \0)
  216.  
  217. unsigned strspn (str,set)     index of 1st char NOT in set (=len of str prefix from set)
  218. unsigned strcspn (str,set)    index of 1st char in set (=len of str prefix NOT from set)
  219.  
  220.  
  221.  
  222. Modify    - returns pointer to given string/buffer or destination string/buffer
  223.  
  224. char *strlwr (str)            converts any upper case to lower
  225. char *strupr (str)            converts any lower case to upper
  226.  
  227. char *strrev (str)            reverses the string leaving \0 untouched
  228.  
  229. char *strset (str,c)          sets all except \0 to c
  230. char *strnset (str,c,n)       sets at most n chars to c, not passing \0
  231.  
  232. char *memset (buf,c,n)        sets 1st n bytes of buf to c
  233.  
  234. char *strcat (dst,src)        appends src to dst
  235. char *strncat (dst,src,n)     appends at most n chars of src to dst
  236. char *strerror (str)          concatenates last error, \n to str (allows str=NULL)
  237.      note: strerror requires definition of errno, sys_nerr, sys_errlist[].
  238.  
  239.  
  240. Examine & Mmodify
  241.  
  242. char *strtok (str,set)        points to 1st token in str (or NULL)
  243.          "   (NULL,set)       points to next token in previous str (or NULL)
  244.      note: set (the delimiters) need not be same on all calls
  245.      also: strtok skips leading delims, replaces delims with \0
  246.  
  247.  
  248.  
  249.                               88-e
  250. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _+
  251. .PAè